﻿/**
 *
 * @file   FITKVAOneHDF5Reader.h
 * @brief  VAOne HDF5 读取
 * @author TanDongYang (tandongyang@diso.cn)
 * @date   2024-11-22
 *
 */

#ifndef FITKVAONEHDF5READER_H
#define FITKVAONEHDF5READER_H

#include "FITKVAOneHDF5IOAPI.h"
#include "FITKVAOneHDF5Base.h"

namespace Acoustics
{
    class FITKAcousticsPostData;
    class FITKAcousticsHDF5LoadCase;
    class FITKAcousticsHDF5Object;
}

namespace VAOne
{
    class FITKVAOneHDF5IOInterface;

    /**
     * @brief   VAOne HDF5 读取
     * @author  TanDongYang (tandongyang@diso.cn)
     * @date    2024-11-22
     */
    class FITKVAOneHDF5IO_API FITKVAOneHDF5Reader :public IO::FITKAbstractHDF5Reader, public FITKVAOneHDF5Base
    {
    public:
        /**
         * @brief   Construct a new FITKVAOneHDF5Reader object
         * @param[i]   interface      组件指针，可传递参数
         * @param[i]   isSuccess      是否执行成功
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-22
         */
        explicit FITKVAOneHDF5Reader(FITKVAOneHDF5IOInterface* interface, bool & isSuccess);

        /**
         * @brief   Destroy the FITKVAOneHDF5Reader object
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-22
         */
        virtual ~FITKVAOneHDF5Reader();

        /**
         * @brief   执行读取操作
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-22
         */
        void run() override;

    protected:
        /**
         * @brief   读取后处理文件内容
         * @return  
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-24 
         */
        bool loadFile();

        /**
         * @brief   读取常数集数据
         * @param[i]   constants 常数集名称
         * @return  
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-24 
         */
        bool readConstants(std::string constants);

        /**
         * @brief   读取载荷工况数据集
         * @param[i]   group    载荷工况数据集名称
         * @return  
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-24 
         */
        bool readLoadCases(std::string group);

        /**
         * @brief   读取单个载荷工况数据集
         * @param[i]   group    
         * @param[i]   loadcase
         * @return  
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-24 
         */
        bool readLoadCase(std::string group, Acoustics::FITKAcousticsHDF5LoadCase* loadCase);


        bool readSubSystemDataMembers(std::string group, Acoustics::FITKAcousticsHDF5Object* subSystems);


        bool readSIFsDataMembers(std::string group, Acoustics::FITKAcousticsHDF5Object* SIFs);

        /**
         * @brief      读取频率数据
         * @param[i]   父组名
         * @param[i]   datasetname 数据集名
         * @return  
         * @author  WangZhenYu (wangzhenyu@diso.cn)
         * @date    2024-11-23
         */
        bool readFrequencyResult(std::string parentGroupdName);



    private:



        /**
         * @brief   打印控制台消息
         * @param[i]   level 打印级别 1 normal 2 warning 3error
         * @param[i]   str 打印的信息
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-22
         */
        void consoleMessage(int level, const QString& str) override;

        /**
         * @brief   清除后处理数据
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-22
         */
        void clearPostData();


        /**
         * @brief   组件对象指针
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-22
         */
        FITKVAOneHDF5IOInterface* _compInterface{};

        /**
         * @brief   是否执行成功
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-22
         */
        bool & _isSuccess;

        /**
         * @brief   后处理数据对象指针
         * @author  TanDongYang (tandongyang@diso.cn)
         * @date    2024-11-22
         */
        Acoustics::FITKAcousticsPostData* _postData{};
    };
}

#endif // FITKVAONEHDF5READER_H
